package com.xxkj.drugtraceability.ui.departdrug

import com.xxkj.drugtraceability.base.BaseRepository
import com.xxkj.drugtraceability.bean.*
import com.xxkj.drugtraceability.net.Result
import com.xxkj.drugtraceability.net.WanService

/**
 * author: zhoujingjin
 * created on: 2024/9/10 16:15
 * description:
 */
class DepartDrugCollectionRepository(val wanService: WanService):BaseRepository() {
    /*
    * 病区加token
    */
    suspend fun queryPrescriptionInfoList( prescriptioninfo:String): Result<BaseData<DepartDrug>> {
        return safeApiCall { executeResponse(wanService.getDrugInfoList(prescriptioninfo)) }
    }

    /**
     * 获取溯源码数据
     */
    suspend fun trugTracCodgIsGather( prescriptioninfo:String): Result<BaseData<DrugDictDataList>> {
        return safeApiCall { executeResponse(wanService.checkIsSync(prescriptioninfo)) }
    }

    /**
     * 保存
     */
    suspend fun finishScanDrugCode( prescriptioninfo:String): Result<Any> {
        return safeApiCall { executeResponse(wanService.saveDrugTracInfo(prescriptioninfo)) }
    }
}